Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 944 #967

Merged
merged 3 commits into from
Jul 14, 2020
Merged

Fix 944 #967

merged 3 commits into from
Jul 14, 2020

Conversation

nojaf
Copy link
Contributor

@nojaf nojaf commented Jul 13, 2020

So the problem we have with #944 is that the trivia detects two keywords and assigns them both to TriviaContentItSelf.
And so the last keyword (member in this case) wins.

I've added a rather targeted workaround to avoid abstract being replaced by member in SynMemberSig.Member.
I think this will make your code compile again, however, in the future it would be nice to preserve both keywords.
This fix might suffice short term...

src/Fantomas/Trivia.fs Outdated Show resolved Hide resolved
@nojaf
Copy link
Contributor Author

nojaf commented Jul 14, 2020

I'm able to restore both keywords now.

|> updateTriviaNode (fun tn -> tn.ContentItself <- Some (Keyword(kw))) triviaNodes
|> updateTriviaNode (fun tn ->
match tn.Type, tn.ContentItself with
| MainNode ("SynMemberSig.Member"), Some (Keyword ({ Content = existingKeywordContent } as token)) when existingKeywordContent =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh my :P the actual content of the code looks fine to me, and I know it's entirely not my place to comment on code layout in a codebase I barely know, but a 120-space indent seems a bit much to me!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I know, but uh the thing is that I formatted it with Fantomas, so yeah 🙈.
I guess we can later use it as sample to improve.

@nojaf nojaf merged commit 3416b51 into fsprojects:master Jul 14, 2020
@nojaf nojaf deleted the fix-944 branch July 14, 2020 19:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants